package br3akr.DeadlyDinnerParty.Server.Actions;

import java.util.Set;

public class ActionFactory {
	
	public Action getAction(String keyword) {
		Action retval = null;
		
		if (containsKeyword(CreateCharacterAction.keywords, keyword)) {
			retval = new CreateCharacterAction();
		} if (containsKeyword(DanceAction.keywords, keyword)) {
			retval = new DanceAction();
		} else if (containsKeyword(LoginAction.keywords, keyword)) {
			retval = new LoginAction();
		} else if (containsKeyword(MoveAction.keywords, keyword)) {
			retval = new MoveAction();
		} else if (containsKeyword(SpeakAction.keywords, keyword)) {
			retval = new SpeakAction();
		} else if (containsKeyword(OpenCloseAction.keywords, keyword)) {
			retval = new OpenCloseAction();
		} else if (containsKeyword(ListenAction.keywords, keyword)) {
			retval = new ListenAction();
		} else if (containsKeyword(BashAction.keywords, keyword)) {
			retval = new BashAction();
		} else if (containsKeyword(DescribeAction.keywords, keyword)) {
			retval = new DescribeAction();
		} else if (containsKeyword(AttackAction.keywords, keyword)) {
			retval = new AttackAction();
		} else if (containsKeyword(HandcuffAction.keywords, keyword)) {
			retval = new HandcuffAction();
		} else if (containsKeyword(GagAction.keywords, keyword)) {
			retval = new GagAction();
		} else if (containsKeyword(DropAction.keywords, keyword)) {
			retval = new DropAction();
		} else if (containsKeyword(GiveAction.keywords, keyword)) {
			retval = new GiveAction();
		} else if (containsKeyword(PutAction.keywords, keyword)) {
			retval = new PutAction();
		} else if (containsKeyword(GetAction.keywords, keyword)) {
			retval = new GetAction();
		} else if (containsKeyword(StowAction.keywords, keyword)) {
			retval = new StowAction();
		} else if (containsKeyword(PickAction.keywords, keyword)) {
			retval = new PickAction();
		} else if (containsKeyword(SearchAction.keywords, keyword)) {
			retval = new SearchAction();
		} else if (containsKeyword(HideAction.keywords, keyword)) {
			retval = new HideAction();
		} else if (containsKeyword(RevealAction.keywords, keyword)) {
			retval = new RevealAction();
		} else if (containsKeyword(ScryAction.keywords, keyword)) {
			retval = new ScryAction();
		}
		return retval;
	}
	
	private boolean containsKeyword(Set<String> keywords, String keyword) {
		for (String curKeyword : keywords) {
			if (curKeyword.equalsIgnoreCase(keyword)) {
				return true;
			}
		}
		return false;
	}
}
